package com.cheetah.start.common.plugin.log;

import cn.hutool.core.util.StrUtil;
import com.p6spy.engine.spy.appender.MessageFormattingStrategy;

public class P6SpyLogFormat implements MessageFormattingStrategy {

    @Override
    public String formatMessage(int connectionId, String now, long elapsed, String category, String prepared, String sql, String url) {
        return StrUtil.isNotBlank(sql) ? "SQL耗时:" + elapsed + "ms " + ":" + sql.replaceAll("[\\s]+", " ") : "";
    }
}
